﻿@using Bifrost.Web.Mvc.Commands
@using Bifrost.Samples.Blog.Mvc.Areas.Administration.Features.Users;
@using Bifrost.Samples.Blog.Views.Security;
@using Bifrost.Samples.Blog.Domain.Security.Commands;
@model IEnumerable<User>
@{
    ViewBag.Title = "Users Administration";
}

<table>
    <tr>
        <td>
            <ul>
                @foreach (var user in Model)
                {
                    @Html.ActionLink(user.UserName, "Show", new { area="Administration", controller="Users", userName = user.UserName })
                    <br />
                }
            
            </ul>
        </td>

        <td>
            @using (var form = Html.BeginCommandForm<CreateUser, UsersController>(c => c.Create(null), FormMethod.Post))
            {
                @form.Html.HiddenFor(c => c.Id);
                @form.Html.LabelFor(c => c.Name)
                @form.Html.TextBoxFor(c => c.Name) <br />
                
                @form.Html.LabelFor(c => c.Password)
                @form.Html.TextBoxFor(c => c.Password) <br />
                
                <input type="submit" value="Create user" />
            }
        </td>
    </tr>


</table>